package labox.innovation.loginserver;

import java.io.IOException;
import java.net.Socket;
import java.util.List;

import javolution.util.FastList;
import labox.innovation.config.Config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author  KenM
 */
public class GameServerListener extends FloodProtectedListener {
	
	private static Logger _log = LoggerFactory.getLogger(GameServerListener.class.getName());

	private static List<GameServerThread> _gameServers = new FastList<GameServerThread>();

	public GameServerListener() throws IOException {
		super(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT);
	}

	/**
	 * @see net.sf.l2j.loginserver.FloodProtectedListener#addClient(java.net.Socket)
	 */
	@Override
	public void addClient(Socket s) {
		if (_log.isDebugEnabled()) {
			_log.debug("Received gameserver connection from: " + s.getInetAddress().getHostAddress());
		}
		GameServerThread gst = new GameServerThread(s);
		_gameServers.add(gst);
	}

	public void removeGameServer(GameServerThread gst) {
		_gameServers.remove(gst);
	}
}
